// XLoader.h

#pragma once

#include "Frm_Mesh.h"
#include "IOModel_X.h"

using namespace System;
using namespace OpenTK;
using namespace ToolBox;

namespace XLoader {

	public ref class GLColor
	{
	public:
		float Red;
		float Green;
		float Blue;
	};
	
	public ref class GLMaterial
	{
	public:
		GLColor^ DiffuseColor;
		GLColor^ EmissiveColor;
		GLColor^ SpecularColor;
	};


	public ref class GLMesh
	{
	public:
		array<Vector3d>^ Vectors;
		array<Vector3d>^ Normals;
		array<Vector2d>^ TexCoords;
		array<unsigned int>^ Indices;
		GLMaterial^ Material;
	};




	public ref class GLModel
	{
	public:
		array<GLMesh^>^ Meshes;
	};

	public ref class XReader
	{
	public:

		XReader();
		GLModel^ ReadXModel(String^ sFilename);


	private:
		bool LoadFromFile(String^ sFilename);
		GLMesh^ ProcessMesh(Frm::Mesh* mesh);
		GLModel^ ProcessModel(Frm::Model3D* model);

		IO_Model_X* m_pObj;
		Frm::Model3D* m_pModel;
	};
}
